import { Controller, Get, Query } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { Config } from 'src/enum/config.enum';

@Controller('rang')
export class RangController {
  constructor(private configServer: ConfigService) {}
  @Get()
  getParams(@Query('num') num: string) {
    // console.log(this.configServer.get('db'), 'CONFIG~~');
    console.log(this.configServer.get('db'));

    if (!!Number(num) && typeof Number(num) === 'number') {
      return new Array(Number(num)).fill('true').map((v, i) => i + 1);
    } else {
      return { code: 500, msg: '格式错误' };
    }
  }
}
